//
//  ZJSCSynopsisModel.m
//  LovingPartyBuilding
//
//  Created by ZJ on 2017/5/11.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "ZJSCSynopsisModel.h"
#import "ZJAdditions.h"
#import "UILabel+LXAdd.h"
@implementation ZJSCSynopsisModel
- (NSString *)description{
    return [self yy_modelDescription];
}

- (ZJSCSynopsisTeacherModel *)TEACHAR_MODEL{
    return [ZJSCSynopsisTeacherModel yy_modelWithJSON:self.TEACHAR.firstObject];
}

- (CGFloat)cellHeight{
    if (self.isSynopsisIntroduce) {//是课程简介
        
        CGFloat nameHeight = [NSString zj_getTextSpaceHeightFromText:self.COURSEWARECOMMENT.NAME font:[UIFont boldSystemFontOfSize:15 * [UIScreen zj_textFontScale]] width:[UIScreen zj_screenWith] - 60 * [UIScreen zj_screenWScale] Space:5 * [UIScreen zj_screenHScale] numberOfLines:0];
        

        CGFloat introduceHeight = 0;
        //计算字体行数
        NSInteger number = [NSString getLineNum:self.COURSEWARECOMMENT.COMMENT font:[UIFont titleTextFont] labelWidth:[UIScreen zj_screenWith] - 60 * [UIScreen zj_screenWScale]];
        
        if (number >= 4 ) {
            if (self.synopsisIntroduce_isUnfold) {
                introduceHeight = [self.COURSEWARECOMMENT.COMMENT getLabelSizeWithLabelFont:[UIFont titleTextFont] labelWidth:[UIScreen zj_screenWith] - 60 * [UIScreen zj_screenWScale] labelNumberOfLines:0 labelLineSpace:4 * [UIScreen zj_screenWScale] labelCharacterSpace:1] + 30;
            }else{
            introduceHeight = [self.COURSEWARECOMMENT.COMMENT getLabelSizeWithLabelFont:[UIFont titleTextFont] labelWidth:[UIScreen zj_screenWith] - 60 * [UIScreen zj_screenWScale] labelNumberOfLines:4 labelLineSpace:4 * [UIScreen zj_screenWScale] labelCharacterSpace:1] + 30;
            }
        }else{
            introduceHeight = [self.COURSEWARECOMMENT.COMMENT getLabelSizeWithLabelFont:[UIFont titleTextFont] labelWidth:[UIScreen zj_screenWith] - 60 * [UIScreen zj_screenWScale] labelNumberOfLines:0 labelLineSpace:4 * [UIScreen zj_screenWScale] labelCharacterSpace:1];
        }
        return nameHeight + introduceHeight + 10 * [UIScreen zj_screenHScale] + 1 ;
    }else{
        

        CGFloat introduceHeight = 0;
        //计算字体行数
        NSInteger number = [NSString getLineNum:self.TEACHAR_MODEL.COMMENT_NOTAG font:[UIFont titleTextFont] labelWidth:[UIScreen zj_screenWith] - 60 * [UIScreen zj_screenWScale]];
        
        if (number >= 4 ) {
            if (self.teacherIntroduce_isUnfold) {
                introduceHeight = [self.TEACHAR_MODEL.COMMENT_NOTAG getLabelSizeWithLabelFont:[UIFont titleTextFont] labelWidth:[UIScreen zj_screenWith] - 60 * [UIScreen zj_screenWScale] labelNumberOfLines:0 labelLineSpace:4 * [UIScreen zj_screenWScale] labelCharacterSpace:1] + 30;
            }else{
                introduceHeight = [self.TEACHAR_MODEL.COMMENT_NOTAG getLabelSizeWithLabelFont:[UIFont titleTextFont] labelWidth:[UIScreen zj_screenWith] - 60 * [UIScreen zj_screenWScale] labelNumberOfLines:4 labelLineSpace:4 * [UIScreen zj_screenWScale] labelCharacterSpace:1] + 30;
            }
            
        }else{
            introduceHeight = [self.TEACHAR_MODEL.COMMENT_NOTAG getLabelSizeWithLabelFont:[UIFont titleTextFont] labelWidth:[UIScreen zj_screenWith] - 60 * [UIScreen zj_screenWScale] labelNumberOfLines:0 labelLineSpace:4 * [UIScreen zj_screenWScale] labelCharacterSpace:1];
        }
        return  introduceHeight + 10 * [UIScreen zj_screenHScale] + 1  + (9 * 2.5) * [UIScreen zj_screenHScale];
    }
}

@end


@implementation ZJSCSynopsisCourseModel

- (NSString *)description{
    return [self yy_modelDescription];
}



@end


@implementation ZJSCSynopsisTeacherModel

- (NSString *)description{
    return [self yy_modelDescription];
}

@end
